{template 'web/_header'}
<ul class="nav nav-tabs">
    <li {if ($_GPC['p'] == 'list' || $_GPC['p'] == '') && ($_GPC['op'] == '' || $_GPC['op'] == 'display')}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/list')}">加盟签约</a></li>
    <li {if $_GPC['p'] == 'experience_meeting' && ($_GPC['op'] == '' || $_GPC['op'] == 'display')}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/experience_meeting')}">体验会</a></li>
    <li {if $_GPC['p'] == 'experience_meeting' && $_GPC['op'] == 'edit'}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/experience_meeting',array('op'=>'edit'))}">编辑体验会</a></li>
    <li {if $_GPC['p'] == 'lesson' && ($_GPC['op'] == '' || $_GPC['op'] == 'display')}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/lesson')}">课程</a></li>
    <li {if $_GPC['p'] == 'lesson' && $_GPC['op'] == 'edit'}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/lesson',array('op'=>'edit'))}">编辑课程</a></li>
    <li {if $_GPC['p'] == 'decorate_case' && ($_GPC['op'] == '' || $_GPC['op'] == 'display')}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/decorate_case')}">装修案例</a></li>
    <li {if $_GPC['p'] == 'decorate_case' && $_GPC['op'] == 'edit'}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/decorate_case',array('op'=>'edit'))}">编辑案例</a></li>
    <li {if $_GPC['p'] == 'decorate_case' && $_GPC['op'] == 'need'}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/decorate_case',array('op'=>'need'))}">装修需求</a></li>
    <li {if $_GPC['p'] == 'activity' && ($_GPC['op'] == '' || $_GPC['op'] == 'display')}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/activity')}">开业活动</a></li>
    <li {if $_GPC['p'] == 'activity' && $_GPC['op'] == 'edit'}class="active"{/if}><a href="{php echo $this->createWebUrl('franchise/activity',array('op'=>'edit'))}">编辑活动</a></li>
    {if ($_GPC['p'] == 'list' || $_GPC['p'] == '') && $_GPC['op'] == 'detail'}<li class="active"><a href="javascript:;">订单详情</a></li>{/if}
    {if $_GPC['p'] == 'experience_meeting' && $_GPC['op'] == 'join'}<li class="active"><a href="javascript:;">会议详情</a></li>{/if}
    {if $_GPC['p'] == 'lesson' && $_GPC['op'] == 'join'}<li class="active"><a href="javascript:;">课程详情</a></li>{/if}
    {if $_GPC['p'] == 'activity' && $_GPC['op'] == 'join'}<li class="active"><a href="javascript:;">活动详情</a></li>{/if}
</ul>
{if $op == 'display'}
<form action="" method="post">
    <div class="panel panel-default">
        <div class="panel-body table-responsive">
            <table class="table table-hover">
                <thead class="navbar-inner">
                    <tr>
                        <th style="width:10%;">ID</th>
                        <th style="width:10%;">活动图片</th>
                        <th style="width:10%;">活动标题</th>
                        <th style="width:10%;">活动简介</th>
                        <th style="width:10%;">创建时间</th>
                        <th style="width:5%;">状态</th>
                        <th style="width:10%;">操作</th>
                    </tr>
                </thead>
                <tbody>
                    {loop $activity $row}
                    <tr>
                        <td style="width:10%">{$row['id']}</td>
                        <td style='width:10%'><img src="http://oss-cn-shenzhen.aliyuncs.com/weixin-lanxue/{$row['image']}" style="width:50px;height:50px;border:1px solid #ccc;"></td>
                        <td style='width:10%'>{$row['title']}</td>
                        <td style='width:10%'>{$row['about']}</td>
                        <td style='width:10%'>{$row['createtime']}</td>
                        <td style='width:10%'>
                            {if $row['status']==1}
                            <label class="label label-success" onclick="isshow(this, {$row['id']})">显示</label>
                            {else}
                            <label class="label label-danger" onclick="isshow(this, {$row['id']})">隐藏</label>
                            {/if}
                        </td>
                        <td style='width:10%'>
                            <a class='btn btn-default btn-sm' href="{php echo $this->createWebUrl('franchise/activity',array('op'=>'edit','id'=>$row['id']))}" title="编辑"><i class="fa fa-pencil"></i></a>
                            <a class='btn btn-default btn-sm' href="{php echo $this->createWebUrl('franchise/activity',array('op'=>'join','id'=>$row['id']))}" title="活动详情"><i class="fa fa-list"></i></a>
                        </td>
                    </tr>
                    {/loop}
                </tbody>
            </table>
            {$pager}
        </div>
    </div>
</form>
<script type="text/javascript">
            function isshow(obj, id){
            $(obj).html($(obj).html() + "...");
                    $.post("{php echo $this->createWebUrl('franchise/activity',array('op'=>'status_set'))}", {id:id}, function(d){
                    $(obj).html($(obj).html().replace("...", ""));
                            if (d.result == 1){
                    $(obj).html(d.status == '1'?'显示':'隐藏');
                            $(obj).attr('class', d.status == 1?"label label-success":"label label-danger");
                    }
                    }, "json");
            }
</script>
{/if}
{if $op=="edit"}
<div class="main">
    <form action="" method="post" class="form-horizontal form" id="form">
        <div class="panel panel-default">
            <div class="panel-heading">编辑案例</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">活动标题</label>
                    <div class="col-xs-12 col-sm-8">
                        <input type="text" name="title" class="form-control" value="{$activity['title']}" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">活动图片</label>
                    <div class="col-xs-12 col-sm-8">
                        {php echo tpl_form_field_image('image', $activity['image']);}
                        <span class="help-block">图片建议为640X300</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">活动简介</label>
                    <div class="col-xs-12 col-sm-8">
                        <textarea  name="about" class="form-control" cols="100"/>{$activity['about']}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">活动详情</label>
                    <div class="col-xs-12 col-sm-8">
                        {php echo tpl_ueditor('description',$activity['description'])}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">是否显示</label>
                    <div class="col-xs-12 col-sm-8">
                        <label class="radio-inline"><input type="radio" name="status" value="1" {if $activity['status']==1}checked="checked"{/if}>显示</label>
                        <label class="radio-inline"><input type="radio" name="status" value="0" {if $activity['status']==0}checked="checked"{/if}>关闭</label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label"></label>

                    <button type="submit" name="submit" class="btn btn-primary" value="1">提交</button> 

                </div>
            </div>
        </div>
    </form>
</div>
{/if}
{if $op=='join'}
<form action="" method="post">
    <div class="panel panel-default">
        <div class="panel-body table-responsive">
            <table class="table table-hover">
                <thead class="navbar-inner">
                    <tr>
                        <th style="width:5%;">ID</th>
                        <th style="width:5%;">活动ID</th>
                        <th style="width:10%;">粉丝</th>
                        <th style="width:10%;">姓名</th>
                        <th style="width:10%;">门店名称</th>
                        <th style="width:10%;">门店地址</th>
                        <th style="width:10%;">联系电话</th>
                    </tr>
                </thead>
                <tbody>
                    {loop $activity $row}
                    <tr>
                        <td style="width:5%">{$row['id']}</td>
                        <td style="width:5%">{$row['activity_id']}</td>
                        <td style='width:5%'><img src="{$row['avatar']}" style="width:50px;height:50px;border:1px solid #ccc;">{$row['nickname']}</td>
                        <td style='width:10%'>{$row['name']}</td>
                        <td style='width:10%'>{$row['shop_name']}</td>
                        <td style='width:10%'>{$row['shop_address']}</td>
                        <td style='width:10%'>{$row['mobile']}</td>
                    </tr>
                    {/loop}
                </tbody>
            </table>
            {$pager}
        </div>
    </div>
</form>
{/if}
{template 'web/_footer'}